package cn.shequren.communityPeople.startup.presenter;

import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.moduleauthorization.register.model.RegisterModelImpl;
import com.jz.community.moduleauthorization.register.ui.RegisterView;

import cn.shequren.communityPeople.startup.bean.StartUpAdvInfo;
import cn.shequren.communityPeople.startup.model.StartUpModel;
import cn.shequren.communityPeople.startup.model.StartUpModelImpl;
import cn.shequren.communityPeople.startup.ui.StartUpView;

/**
 * Created by Tony.Fan on 2018/3/23 17:53
 */
public class StartUpPresenter extends BaseLifeCyclePresent<StartUpView.View> implements StartUpView.Presenter {

    private StartUpView.View mView;
    private StartUpModel startUpModel;

    public StartUpPresenter(StartUpView.View view) {
        mView = view;
        startUpModel = new StartUpModelImpl(view.getContext());
    }

    @Override
    public void setPresenter(StartUpView.View v) {
        super.setPresenter(v);
    }

    @Override
    public void getStartUpAdvInfo() {
        startUpModel.requestStartUpAdv(new OnLoadListener<StartUpAdvInfo>() {
            @Override
            public void onSuccess(StartUpAdvInfo startUpAdvInfo) {
                mView.showStartUpAdvInfo(startUpAdvInfo);
            }

            @Override
            public void onFail(String s,int code) {
                mView.showStartUpAdvInfo(null);
            }
        });
    }
}
